package com.wdl.modules.myhouse.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wdl.modules.myhouse.dao.SysMenuDao;
import com.wdl.modules.myhouse.dao.SysMenuRoleDao;
import com.wdl.modules.myhouse.entity.sys.SysMenuEntity;
import com.wdl.modules.myhouse.entity.sys.SysMenuRoleEntity;
import com.wdl.modules.myhouse.service.SysMenuRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 菜单角色关系依赖对照表
 *
 * @author lucain sunlightcs@gmail.com
 * @since 1.0.0 2022-09-11
 */
@Service
public class SysMenuRoleServiceImpl extends ServiceImpl<SysMenuRoleDao, SysMenuRoleEntity> implements SysMenuRoleService {

    @Autowired
    private SysMenuDao sysMenuDao;

    @Override
    public List<SysMenuEntity> getMenusByRoleIds(List<Integer> roleIds) {
        return sysMenuDao.getMenusByRoleIds(roleIds.stream().distinct().collect(Collectors.toList()));
    }
}